package com.ruoyi.web.controller.app;
import com.ruoyi.order.domain.app.Vo.NoticeResultVo;
import com.ruoyi.order.domain.app.Vo.NoticeVo;
import com.ruoyi.order.service.INoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 陈焕然
 * @version 1.0
 */
@Controller
@RequestMapping("/app")

public class NoticeAppController {
    @Autowired
    private INoticeService noticeService;

    @RequestMapping("/shop/notice/noticeList")
    @ResponseBody
    public NoticeResultVo getNotice(Integer current, Integer size){
        List<NoticeVo> list  = noticeService.getNotices();
        NoticeResultVo resultList = new NoticeResultVo();
        resultList.setRecords(list);
        resultList.setCurrent(current);
        resultList.setSize(size);
        resultList.setOptimizeCountSql(true);
        resultList.setSearchCount(true);
        resultList.setMaxLimit(null);
        resultList.setTotal(noticeService.count());
        return resultList;
    }
    //首页数据
    @RequestMapping("/shop/notice/topNoticeList")
    @ResponseBody
    public List<NoticeVo>  topNoticeList(){
        List<NoticeVo> list  = noticeService.getNotices();
        return list;
    }
}
